package com.roc.web.action.dailiReport;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class DailiReportSearchCondition extends BaseSearchCondition{

	private String orgCode;
	private String realName;
	private String accountNo;
	private String startDate;
	private String endDate;
	
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		// TODO Auto-generated method stub
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		
		if(Constance.isNotEmpty(orgCode)&&!orgCode.equals("99")){
			filedBeanList.add(new WhereHQLFieldBean("m.orgCode", orgCode.trim(), "=", false));
		}
		if(Constance.isNotEmpty(realName)){
			filedBeanList.add(new WhereHQLFieldBean("m.realName", realName.trim(), "like", false,"ALL"));
		}
		if(Constance.isNotEmpty(accountNo)){
			filedBeanList.add(new WhereHQLFieldBean("m.accountNo", accountNo.trim(), "like", false,"ALL"));
		}
		if (Constance.isNotEmpty(startDate) && Constance.isNotEmpty(endDate)) {
			filedBeanList.add(new WhereHQLFieldBean("m.transDate", startDate,
					">=", false));
			filedBeanList.add(new WhereHQLFieldBean("m.transDate", endDate,
					"<=", false));
		}
		
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		// TODO Auto-generated method stub
		return "select count(*) from MerchantReport m ,MccType t where m.mccType=t.mccTypeCode ";
	}

	@Override
	protected String getSearchHQL() {
		// TODO Auto-generated method stub
		return "select m.accountNo,m.realName,m.orgCode,t.mccTypeName,m.totalFee,m.totalAmt,m.totalNum,m.transDate from MerchantReport m,MccType t where m.mccType=t.mccTypeCode ";
	}

	@Override
	protected String getOrderPartOfHQL() {
		// TODO Auto-generated method stub
		return "order by m.transDate ";
	}

	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getAccountNo() {
		return accountNo;
	}

	public void setAccountNo(String accountNo) {
		this.accountNo = accountNo;
	}

	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}
	
	

}
